<?php


namespace app\api\controller;



use app\api\model\CardModel;
use app\api\model\CardOrdersModel;
use app\api\model\FeedbackModel;
use app\api\model\OrdersModel;
use app\api\model\UserModel;

class Personal extends ApiBase
{

    /**
     *
     * 个人用户信息
     */
    public function userInfo(){


        $id = $this->id;
        $data = UserModel::userInfo(['id'=>$id],'id,phone,head_img,nickname,is_certified');
        $this->successful('查询成功',$data);
    }

    /**
     *
     * 修改用户信息
     */
    public function userEdit(){

        $params = input();
        $params['id'] = $this->id;
        $res = UserModel::userEdit($params);
        if ($res){

            $this->successful('操作成功！');
        }else{

            $this->fail('操作失败');
        }
    }

    /**
     *
     * 意见反馈
     */
    public function feedbackAdd(){

        $params = $this->request->post();
        $params['user_id'] = $this->id;
        if (!isset($params['content']) || $params['content'] == ''){

            $this->fail('请输入意见反馈内容');
        }

        $res = FeedbackModel::feedbackAdd($params);
        if ($res){

            $this->successful('意见反馈成功');
        }else{

            $this->fail('意见反馈失败');
        }
    }





}